﻿using System.Collections.ObjectModel;
using System.Windows.Input;
using DevExpress.Mvvm;
using EduAssess.Models;
using EduAssess.Services;

namespace EduAssess.ViewModels;

public class StatisticsPageViewModel : BindableBase
{
    private readonly TestState _testState;
    private readonly PageNavigationService _navigationService;

    public int Result { get; set; }
    public ObservableCollection<Question> Questions { get; private set; }


    public StatisticsPageViewModel(TestState testState, PageNavigationService navigationService)
    {
        _testState = testState;
        _navigationService = navigationService;
        Questions = new ObservableCollection<Question>();
        Result = _testState.TestResult;
    }

    public ICommand ShowRightQuestions => new DelegateCommand(() =>
    {
        Questions = _testState.RightAnswers;
    });

    public ICommand ShowWrongQuestions => new DelegateCommand(() =>
    {
        Questions = _testState.WrongAnswers;
    });

    public ICommand ToStartPage => new DelegateCommand(() =>
    {
        _navigationService.ToStartPage();
    });
}